	package com.younion.dao;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.younion.common.base.BaseDAO;
import com.younion.common.base.BaseVO;
import com.younion.common.exception.BaseException;
import com.younion.common.paginator.Paginator;
import com.younion.vo.MemberCardUpgradeLogVO;

public class MemberCardUpgradeLogDAO extends BaseDAO {
	
	protected static final Log logger = LogFactory.getLog(MemberCardUpgradeLogDAO.class);

	 
	public int selectCountByMap(Map paramMap) throws BaseException {
		try {
			return queryCount("t_member_card_upgrade_log.selectByMapCount", paramMap);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			throw new BaseException(this.getClass().getSimpleName() +" method error");
		}
	}

	 
	public List selectForPage(Map condition, Paginator paginator)
			throws BaseException {
		int pageIndex = paginator.getStartIndex();
		int perPageSize = paginator.getPageSize();
		String sqlStr = "";
		try {
			if (condition == null) {
				sqlStr = "t_member_card_upgrade_log.selectAll";
			} else {
				sqlStr = "t_member_card_upgrade_log.selectByMap";
			}
			return queryForPage(sqlStr, condition, pageIndex, perPageSize);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			throw new BaseException(this.getClass().getSimpleName() +" method error");
		}
	}

	 
	public Integer insertByVo(MemberCardUpgradeLogVO memberCardUpgradeLogVO) throws BaseException {
		if (memberCardUpgradeLogVO == null)
			return null;
		try {
			return (Integer) this.getSqlMapClientTemplate().insert(
					"t_member_card_upgrade_log.insertByVo", (BaseVO) memberCardUpgradeLogVO);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			throw new BaseException(this.getClass().getSimpleName() +" method error");
		}
	}

}